home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209b.zip / octave-2.09 / doc / octave.i03 (.txt) < prev    next >
GNU Info File  |  1997-08-20  |  49KB  |  1,125 lines

  1. This is Info file octave, produced by Makeinfo-1.64 from the input file
  2. octave.tex.
  3. START-INFO-DIR-ENTRY
  4. * Octave: (octave).     Interactive language for numerical computations.
  5. END-INFO-DIR-ENTRY
  6.    Copyright (C) 1996, 1997 John W. Eaton.
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided that
  12. the entire resulting derived work is distributed under the terms of a
  13. permission notice identical to this one.
  14.    Permission is granted to copy and distribute translations of this
  15. manual into another language, under the above conditions for modified
  16. versions.
  17. File: octave,  Node: Data Structures,  Next: Variables,  Prev: Strings,  Up: Top
  18. Data Structures
  19. ***************
  20.    Octave includes support for organizing data in structures.  The
  21. current implementation uses an associative array with indices limited to
  22. strings, but the syntax is more like C-style structures.  Here are some
  23. examples of using data structures in Octave.
  24.    Elements of structures can be of any value type.  For example, the
  25. three expressions
  26.      x.a = 1
  27.      x.b = [1, 2; 3, 4]
  28.      x.c = "string"
  29. create a structure with three elements.  To print the value of the
  30. structure, you can type its name, just as for any other variable:
  31.      octave:2> x
  32.      x =
  33.      {
  34.        a = 1
  35.        b =
  36.      
  37.          1  2
  38.          3  4
  39.      
  40.        c = string
  41.      }
  42. Note that Octave may print the elements in any order.
  43.    Structures may be copied.
  44.      octave:1> y = x
  45.      y =
  46.      {
  47.        a = 1
  48.        b =
  49.      
  50.          1  2
  51.          3  4
  52.      
  53.        c = string
  54.      }
  55.    Since structures are themselves values, structure elements may
  56. reference other structures.  The following statements change the value
  57. of the element `b' of the structure `x' to be a data structure
  58. containing the single element `d', which has a value of 3.
  59.      octave:1> x.b.d = 3
  60.      x.b.d = 3
  61.      octave:2> x.b
  62.      ans =
  63.      {
  64.        d = 3
  65.      }
  66.      octave:3> x
  67.      x =
  68.      {
  69.        a = 1
  70.        b =
  71.        {
  72.          d = 3
  73.        }
  74.      
  75.        c = string
  76.      }
  77.    Note that when Octave prints the value of a structure that contains
  78. other structures, only a few levels are displayed.  For example,
  79.      octave:1> a.b.c.d.e = 1;
  80.      octave:2> a
  81.      a =
  82.      {
  83.        b =
  84.        {
  85.          c = <structure>
  86.        }
  87.      }
  88. This prevents long and confusing output from large deeply nested
  89. structures.
  90.  - Built-in Variable: struct_levels_to_print
  91.      You can tell Octave how many structure levels to display by
  92.      setting the built-in variable `struct_levels_to_print'.  The
  93.      default value is 2.
  94.    Functions can return structures.  For example, the following function
  95. separates the real and complex parts of a matrix and stores them in two
  96. elements of the same structure variable.
  97.      octave:1> function y = f (x)
  98.      > y.re = real (x);
  99.      > y.im = imag (x);
  100.      > endfunction
  101.    When called with a complex-valued argument, `f' returns the data
  102. structure containing the real and imaginary parts of the original
  103. function argument.
  104.      octave:2> f (rand (3) + rand (3) * I);
  105.      ans =
  106.      {
  107.        im =
  108.      
  109.          0.26475  0.14828
  110.          0.18436  0.83669
  111.      
  112.        re =
  113.      
  114.          0.040239  0.242160
  115.          0.238081  0.402523
  116.      }
  117.    Function return lists can include structure elements, and they may be
  118. indexed like any other variable.  For example,
  119.      octave:1> [ x.u, x.s(2:3,2:3), x.v ] = svd ([1, 2; 3, 4])
  120.      x.u =
  121.      
  122.        -0.40455  -0.91451
  123.        -0.91451   0.40455
  124.      
  125.      x.s =
  126.      
  127.        0.00000  0.00000  0.00000
  128.        0.00000  5.46499  0.00000
  129.        0.00000  0.00000  0.36597
  130.      
  131.      x.v =
  132.      
  133.        -0.57605   0.81742
  134.        -0.81742  -0.57605
  135.    It is also possible to cycle through all the elements of a structure
  136. in a loop, using a special form of the `for' statement (*note The for
  137. Statement::.)
  138.    The following functions are available to give you information about
  139. structures.
  140.  - Built-in Function:  is_struct (EXPR)
  141.      Return 1 if the value of the expression EXPR is a structure.
  142.  - Built-in Function:  struct_contains (EXPR, NAME)
  143.      Return 1 if the expression EXPR is a structure and it includes an
  144.      element named NAME.  The first argument must be a structure and
  145.      the second must be a string.
  146.  - Built-in Function:  struct_elements (STRUCT)
  147.      Return a list of strings naming the elements of the structure
  148.      STRUCT.  It is an error to call `struct_elements' with an argument
  149.      that is not a structure.
  150. File: octave,  Node: Variables,  Next: Expressions,  Prev: Data Structures,  Up: Top
  151. Variables
  152. *********
  153.    Variables let you give names to values and refer to them later.  You
  154. have already seen variables in many of the examples.  The name of a
  155. variable must be a sequence of letters, digits and underscores, but it
  156. may not begin with a digit.  Octave does not enforce a limit on the
  157. length of variable names, but it is seldom useful to have variables
  158. with names longer than about 30 characters.  The following are all
  159. valid variable names
  160.      x
  161.      x15
  162.      __foo_bar_baz__
  163.      fucnrdthsucngtagdjb
  164. However, names like `__foo_bar_baz__' that begin and end with two
  165. underscores are understood to be reserved for internal use by Octave.
  166. You should not use them in code you write, except to access Octave's
  167. documented internal variables and built-in symbolic constants.
  168.    Case is significant in variable names.  The symbols `a' and `A' are
  169. distinct variables.
  170.    A variable name is a valid expression by itself.  It represents the
  171. variable's current value.  Variables are given new values with
  172. "assignment operators" and "increment operators".  *Note Assignment
  173. Expressions: Assignment Ops.
  174.    A number of variables have special built-in meanings.  For example,
  175. `PWD' holds the current working directory, and `pi' names the ratio of
  176. the circumference of a circle to its diameter. *Note Summary of
  177. Built-in Variables::, for a list of all the predefined variables.  Some
  178. of these built-in symbols are constants and may not be changed.  Others
  179. can be used and assigned just like all other variables, but their values
  180. are also used or changed automatically by Octave.
  181.    Variables in Octave do not have fixed types, so it is possible to
  182. first store a numeric value in a variable and then to later use the
  183. same name to hold a string value in the same program.  Variables may
  184. not be used before they have been given a value.  Doing so results in
  185. an error.
  186. * Menu:
  187. * Global Variables::
  188. * Status of Variables::
  189. * Summary of Built-in Variables::
  190. * Defaults from the Environment::
  191. File: octave,  Node: Global Variables,  Next: Status of Variables,  Prev: Variables,  Up: Variables
  192. Global Variables
  193. ================
  194.    A variable that has been declared "global" may be accessed from
  195. within a function body without having to pass it as a formal parameter.
  196.    A variable may be declared global using a `global' declaration
  197. statement.  The following statements are all global declarations.
  198.      global a
  199.      global b = 2
  200.      global c = 3, d, e = 5
  201.    It is necessary declare a variable as global within a function body
  202. in order to access it.  For example,
  203.      global x
  204.      function f ()
  205.        x = 1;
  206.      endfunction
  207.      f ()
  208. does *not* set the value of the global variable `x' to 1.  In order to
  209. change the value of the global variable `x', you must also declare it
  210. to be global within the function body, like this
  211.      function f ()
  212.        global x;
  213.        x = 1;
  214.      endfunction
  215.    Passing a global variable in a function parameter list will make a
  216. local copy and not modify the global value.  For example, given the
  217. function
  218.      function f (x)
  219.        x = 0
  220.      endfunction
  221. and the definition of `x' as a global variable at the top level,
  222.      global x = 13
  223. the expression
  224.      f (x)
  225. will display the value of `x' from inside the function as 0, but the
  226. value of `x' at the top level remains unchanged, because the function
  227. works with a *copy* of its argument.
  228.  - Built-in Variable: warn_comma_in_global_decl
  229.      If the value of `warn_comma_in_global_decl' is nonzero, a warning
  230.      is issued for statements like
  231.           global a = 1, b
  232.      which makes the variables `a' and `b' global and assigns the value
  233.      1 to the variable `a', because in this context, the comma is not
  234.      interpreted as a statement separator.
  235.      The default value of `warn_comma_in_global_decl' is nonzero.
  236.  - Built-in Function:  is_global (NAME)
  237.      Return 1 if NAME is globally visible.  Otherwise, return 0.  For
  238.      example,
  239.           global x
  240.           is_global ("x")
  241.                => 1
  242. File: octave,  Node: Status of Variables,  Next: Summary of Built-in Variables,  Prev: Global Variables,  Up: Variables
  243. Status of Variables
  244. ===================
  245.  - Command: clear OPTIONS PATTERN ...
  246.      Delete the names matching the given patterns from the symbol
  247.      table.  The pattern may contain the following special characters:
  248.     `?'
  249.           Match any single character.
  250.     `*'
  251.           Match zero or more characters.
  252.     `[ LIST ]'
  253.           Match the list of characters specified by LIST.  If the first
  254.           character is `!' or `^', match all characters except those
  255.           specified by LIST.  For example, the pattern `[a-zA-Z]' will
  256.           match all lower and upper case alphabetic characters.
  257.      For example, the command
  258.           clear foo b*r
  259.      clears the name `foo' and all names that begin with the letter `b'
  260.      and end with the letter `r'.
  261.      If `clear' is called without any arguments, all user-defined
  262.      variables (local and global) are cleared from the symbol table.  If
  263.      `clear' is called with at least one argument, only the visible
  264.      names matching the arguments are cleared.  For example, suppose
  265.      you have defined a function `foo', and then hidden it by
  266.      performing the assignment `foo = 2'.  Executing the command `clear
  267.      foo' once will clear the variable definition and restore the
  268.      definition of `foo' as a function.  Executing `clear foo' a second
  269.      time will clear the function definition.
  270.      This command may not be used within a function body.
  271.  - Command: who OPTIONS PATTERN ...
  272.  - Command: whos OPTIONS PATTERN ...
  273.      List currently defined symbols matching the given patterns.  The
  274.      following are valid options.  They may be shortened to one
  275.      character but may not be combined.
  276.     `-all'
  277.           List all currently defined symbols.
  278.     `-builtins'
  279.           List built-in variables and functions.  This includes all
  280.           currently compiled function files, but does not include all
  281.           function files that are in the `LOADPATH'.
  282.     `-functions'
  283.           List user-defined functions.
  284.     `-long'
  285.           Print a long listing including the type and dimensions of any
  286.           symbols.  The symbols in the first column of output indicate
  287.           whether it is possible to redefine the symbol, and whether it
  288.           is possible for it to be cleared.
  289.     `-variables'
  290.           List user-defined variables.
  291.      Valid patterns are the same as described for the `clear' command
  292.      above.  If no patterns are supplied, all symbols from the given
  293.      category are listed.  By default, only user defined functions and
  294.      variables visible in the local scope are displayed.
  295.      The command `whos' is equivalent to `who -long'.
  296.  - Built-in Function:  exist (NAME)
  297.      Return 1 if the name exists as a variable, 2 if the name (after
  298.      appending `.m') is a function file in the path, 3 if the name is a
  299.      `.oct' file in the path, or 5 if the name is a built-in function.
  300.      Otherwise, return 0.
  301.  - Built-in Function:  document (SYMBOL, TEXT)
  302.      Set the documentation string for SYMBOL to TEXT.
  303.  - Command: type OPTIONS NAME ...
  304.      Display the definition of each NAME that refers to a function.
  305.      Normally also displays if each NAME is user-defined or builtin;
  306.      the `-q' option suppresses this behaviour.
  307.      Currently, Octave can only display functions that can be compiled
  308.      cleanly, because it uses its internal representation of the
  309.      function to recreate the program text.
  310.      Comments are not displayed because Octave's parser currently
  311.      discards them as it converts the text of a function file to its
  312.      internal representation.  This problem may be fixed in a future
  313.      release.
  314.  - Command: which NAME ...
  315.      Display the type of each NAME.  If NAME is defined from a function
  316.      file, the full name of the file is also displayed.
  317. File: octave,  Node: Summary of Built-in Variables,  Next: Defaults from the Environment,  Prev: Status of Variables,  Up: Variables
  318. Summary of Built-in Variables
  319. =============================
  320.    Here is a summary of all of Octave's built-in variables along with
  321. cross references to additional information and their default values.  In
  322. the following table OCTAVE-HOME stands for the root directory where all
  323. of Octave is installed (the default is `', VERSION stands for the
  324. Octave version number (for example, 2.0.5) and ARCH stands for the type
  325. of system for which Octave was compiled (for example, `i486-OS/2').
  326. `EDITOR'
  327.      *Note Commands For History::.
  328.      Default value: `"emacs"'.
  329. `EXEC_PATH'
  330.      *Note Controlling Subprocesses::.
  331.      Default value: `":$PATH"'.
  332. `INFO_FILE'
  333.      *Note Getting Help::.
  334.      Default value: `"OCTAVE-HOME/info/octave.info"'.
  335. `INFO_PROGRAM'
  336.      *Note Getting Help::.
  337.      Default value:
  338.      `"OCTAVE-HOME/libexec/octave/VERSION/exec/ARCH/info"'.
  339. `LOADPATH'
  340.      *Note Function Files::.
  341.      Default value: `".:OCTAVE-HOME/lib/VERSION"'.
  342. `OCTAVE_HOME'
  343.      Default value: `""'.
  344. `PAGER'
  345.      *Note Input and Output::.
  346.      Default value: `"less", or "more"'.
  347. `PS1'
  348.      *Note Customizing the Prompt::.
  349.      Default value: `"\s:\#> "'.
  350. `PS2'
  351.      *Note Customizing the Prompt::.
  352.      Default value: `"> "'.
  353. `PS4'
  354.      *Note Customizing the Prompt::.
  355.      Default value: `"+ "'.
  356. `automatic_replot'
  357.      *Note Two-Dimensional Plotting::.
  358.      Default value: 0.
  359. `beep_on_error'
  360.      *Note Error Handling::.
  361.      Default value: 0.
  362. `completion_append_char'
  363.      *Note Commands For Completion::.
  364.      Default value: `" "'.
  365. `default_eval_print_flag'
  366.      *Note Evaluation::.
  367.      Default value: 1.
  368. `default_return_value'
  369.      *Note Multiple Return Values::.
  370.      Default value: `[]'.
  371. `default_save_format'
  372.      *Note Simple File I/O::.
  373.      Default value: `"ascii"'.
  374. `do_fortran_indexing'
  375.      *Note Index Expressions::.
  376.      Default value: 0.
  377. `define_all_return_values'
  378.      *Note Multiple Return Values::.
  379.      Default value: 0.
  380. `empty_list_elements_ok'
  381.      *Note Empty Matrices::.
  382.      Default value: `"warn"'.
  383. `gnuplot_binary'
  384.      *Note Three-Dimensional Plotting::.
  385.      Default value: `"gnuplot"'.
  386. `history_file'
  387.      *Note Commands For History::.
  388.      Default value: `"~/.octave_hist"'.
  389. `history_size'
  390.      *Note Commands For History::.
  391.      Default value: 1024.
  392. `ignore_function_time_stamp'
  393.      *Note Function Files::.
  394.      Default value: `"system"'.
  395. `implicit_str_to_num_ok'
  396.      *Note String Conversions::.
  397.      Default value: 0.
  398. `ok_to_lose_imaginary_part'
  399.      *Note Special Utility Matrices::.
  400.      Default value: `"warn"'.
  401. `output_max_field_width'
  402.      *Note Matrices::.
  403.      Default value: 10.
  404. `output_precision'
  405.      *Note Matrices::.
  406.      Default value: 5.
  407. `page_screen_output'
  408.      *Note Input and Output::.
  409.      Default value: 1.
  410. `prefer_column_vectors'
  411.      *Note Index Expressions::.
  412.      Default value: 0.
  413. `print_answer_id_name'
  414.      *Note Terminal Output::.
  415.      Default value: 1.
  416. `print_empty_dimensions'
  417.      *Note Empty Matrices::.
  418.      Default value: 1.
  419. `resize_on_range_error'
  420.      *Note Index Expressions::.
  421.      Default value: 1.
  422. `return_last_computed_value'
  423.      *Note Returning From a Function::.
  424.      Default value: 0.
  425. `save_precision'
  426.      *Note Simple File I/O::.
  427.      Default value: 17.
  428. `saving_history'
  429.      *Note Commands For History::.
  430.      Default value: 1.
  431. `silent_functions'
  432.      *Note Defining Functions::.
  433.      Default value: 0.
  434. `split_long_rows'
  435.      *Note Matrices::.
  436.      Default value: 1.
  437. `struct_levels_to_print'
  438.      *Note Data Structures::.
  439.      Default value: 2.
  440. `suppress_verbose_help_message'
  441.      *Note Getting Help::.
  442.      Default value: 1.
  443. `treat_neg_dim_as_zero'
  444.      *Note Special Utility Matrices::.
  445.      Default value: 0.
  446. `warn_assign_as_truth_value'
  447.      *Note The if Statement::.
  448.      Default value: 1.
  449. `warn_comma_in_global_decl'
  450.      *Note Global Variables::.
  451.      Default value: 1.
  452. `warn_divide_by_zero'
  453.      *Note Arithmetic Ops::.
  454.      Default value: 1.
  455. `warn_function_name_clash'
  456.      *Note Function Files::.
  457.      Default value: 1.
  458. `whitespace_in_literal_matrix'
  459.      *Note Matrices::.
  460.      Default value: `""'.
  461. File: octave,  Node: Defaults from the Environment,  Prev: Summary of Built-in Variables,  Up: Variables
  462. Defaults from the Environment
  463. =============================
  464.    Octave uses the values of the following environment variables to set
  465. the default values for the corresponding built-in variables.  In
  466. addition, the values from the environment may be overridden by
  467. command-line arguments.  *Note Command Line Options::.
  468. `EDITOR'
  469.      *Note Commands For History::.
  470.      Built-in variable: `EDITOR'.
  471. `OCTAVE_EXEC_PATH'
  472.      *Note Controlling Subprocesses::.
  473.      Built-in variable: `EXEC_PATH'.  Command-line argument:
  474.      `--exec-path'.
  475. `OCTAVE_PATH'
  476.      *Note Function Files::.
  477.      Built-in variable: `LOADPATH'.  Command-line argument: `--path'.
  478. `OCTAVE_INFO_FILE'
  479.      *Note Getting Help::.
  480.      Built-in variable: `INFO_FILE'.  Command-line argument:
  481.      `--info-file'.
  482. `OCTAVE_INFO_PROGRAM'
  483.      *Note Getting Help::.
  484.      Built-in variable: `INFO_PROGRAM'.  Command-line argument:
  485.      `--info-program'.
  486. `OCTAVE_HISTSIZE'
  487.      *Note Commands For History::.
  488.      Built-in variable: `history_size'.
  489. `OCTAVE_HISTFILE'
  490.      *Note Commands For History::.
  491.      Built-in variable: `history_file'.
  492. File: octave,  Node: Expressions,  Next: Evaluation,  Prev: Variables,  Up: Top
  493. Expressions
  494. ***********
  495.    Expressions are the basic building block of statements in Octave.  An
  496. expression evaluates to a value, which you can print, test, store in a
  497. variable, pass to a function, or assign a new value to a variable with
  498. an assignment operator.
  499.    An expression can serve as a statement on its own.  Most other kinds
  500. of statements contain one or more expressions which specify data to be
  501. operated on.  As in other languages, expressions in Octave include
  502. variables, array references, constants, and function calls, as well as
  503. combinations of these with various operators.
  504. * Menu:
  505. * Index Expressions::
  506. * Calling Functions::
  507. * Arithmetic Ops::
  508. * Comparison Ops::
  509. * Boolean Expressions::
  510. * Assignment Ops::
  511. * Increment Ops::
  512. * Operator Precedence::
  513. File: octave,  Node: Index Expressions,  Next: Calling Functions,  Prev: Expressions,  Up: Expressions
  514. Index Expressions
  515. =================
  516.    An "index expression" allows you to reference or extract selected
  517. elements of a matrix or vector.
  518.    Indices may be scalars, vectors, ranges, or the special operator
  519. `:', which may be used to select entire rows or columns.
  520.    Vectors are indexed using a single expression.  Matrices require two
  521. indices unless the value of the built-in variable `do_fortran_indexing'
  522. is nonzero, in which case matrices may also be indexed by a single
  523. expression.
  524.  - Built-in Variable: do_fortran_indexing
  525.      If the value of `do_fortran_indexing' is nonzero, Octave allows
  526.      you to select elements of a two-dimensional matrix using a single
  527.      index by treating the matrix as a single vector created from the
  528.      columns of the matrix.  The default value is 0.
  529.    Given the matrix
  530.      a = [1, 2; 3, 4]
  531. all of the following expressions are equivalent
  532.      a (1, [1, 2])
  533.      a (1, 1:2)
  534.      a (1, :)
  535. and select the first row of the matrix.
  536.    A special form of indexing may be used to select elements of a
  537. matrix or vector.  If the indices are vectors made up of only ones and
  538. zeros, the result is a new matrix whose elements correspond to the
  539. elements of the index vector that are equal to one.  For example,
  540.      a = [1, 2; 3, 4];
  541.      a ([1, 0], :)
  542. selects the first row of the matrix `a'.
  543.    This operation can be useful for selecting elements of a matrix
  544. based on some condition, since the comparison operators return matrices
  545. of ones and zeros.
  546.    This special zero-one form of indexing leads to a conflict with the
  547. standard indexing operation.  For example, should the following
  548. statements
  549.      a = [1, 2; 3, 4];
  550.      a ([1, 1], :)
  551. return the original matrix, or the matrix formed by selecting the first
  552. row twice?  Although this conflict is not likely to arise very often in
  553. practice, you may select the behavior you prefer by setting the built-in
  554. variable `prefer_zero_one_indexing'.
  555.  - Built-in Variable: prefer_zero_one_indexing
  556.      If the value of `prefer_zero_one_indexing' is nonzero, Octave will
  557.      perform zero-one style indexing when there is a conflict with the
  558.      normal indexing rules.  *Note Index Expressions::.  For example,
  559.      given a matrix
  560.           a = [1, 2, 3, 4]
  561.      with `prefer_zero_one_indexing' is set to nonzero, the expression
  562.           a ([1, 1, 1, 1])
  563.      results in the matrix `[ 1, 2, 3, 4 ]'.  If the value of
  564.      `prefer_zero_one_indexing' set to 0, the result would be the
  565.      matrix `[ 1, 1, 1, 1 ]'.
  566.      In the first case, Octave is selecting each element corresponding
  567.      to a `1' in the index vector.  In the second, Octave is selecting
  568.      the first element multiple times.
  569.      The default value for `prefer_zero_one_indexing' is 0.
  570.    Finally, indexing a scalar with a vector of ones can be used to
  571. create a vector the same size as the the index vector, with each
  572. element equal to the value of the original scalar.  For example, the
  573. following statements
  574.      a = 13;
  575.      a ([1, 1, 1, 1])
  576. produce a vector whose four elements are all equal to 13.
  577.    Similarly, indexing a scalar with two vectors of ones can be used to
  578. create a matrix.  For example the following statements
  579.      a = 13;
  580.      a ([1, 1], [1, 1, 1])
  581. create a 2 by 3 matrix with all elements equal to 13.
  582.    This is an obscure notation and should be avoided.  It is better to
  583. use the function `ones' to generate a matrix of the appropriate size
  584. whose elements are all one, and then to scale it to produce the desired
  585. result.  *Note Special Utility Matrices::.
  586.  - Built-in Variable: prefer_column_vectors
  587.      If `prefer_column_vectors' is nonzero, operations like
  588.           for i = 1:10
  589.             a (i) = i;
  590.           endfor
  591.      (for `a' previously  undefined) produce column vectors.
  592.      Otherwise, row vectors are preferred.  The default value is 0.
  593.      If a variable is already defined to be a vector (a matrix with a
  594.      single row or column), the original orientation is respected,
  595.      regardless of the value of `prefer_column_vectors'.
  596.  - Built-in Variable: resize_on_range_error
  597.      If the value of `resize_on_range_error' is nonzero, expressions
  598.      like
  599.           for i = 1:10
  600.             a (i) = sqrt (i);
  601.           endfor
  602.      (for `a' previously undefined) result in the variable `a' being
  603.      resized to be just large enough to hold the new value.  New
  604.      elements that have not been given a value are set to zero.  If the
  605.      value of `resize_on_range_error' is 0, an error message is printed
  606.      and control is returned to the top level.  The default value is 1.
  607.    Note that it is quite inefficient to create a vector using a loop
  608. like the one shown in the example above.  In this particular case, it
  609. would have been much more efficient to use the expression
  610.      a = sqrt (1:10);
  611. thus avoiding the loop entirely.  In cases where a loop is still
  612. required, or a number of values must be combined to form a larger
  613. matrix, it is generally much faster to set the size of the matrix first,
  614. and then insert elements using indexing commands.  For example, given a
  615. matrix `a',
  616.      [nr, nc] = size (a);
  617.      x = zeros (nr, n * nc);
  618.      for i = 1:n
  619.        x(:,(i-1)*n+1:i*n) = a;
  620.      endfor
  621. is considerably faster than
  622.      x = a;
  623.      for i = 1:n-1
  624.        x = [x, a];
  625.      endfor
  626. particularly for large matrices because Octave does not have to
  627. repeatedly resize the result.
  628. File: octave,  Node: Calling Functions,  Next: Arithmetic Ops,  Prev: Index Expressions,  Up: Expressions
  629. Calling Functions
  630. =================
  631.    A "function" is a name for a particular calculation.  Because it has
  632. a name, you can ask for it by name at any point in the program.  For
  633. example, the function `sqrt' computes the square root of a number.
  634.    A fixed set of functions are "built-in", which means they are
  635. available in every Octave program.  The `sqrt' function is one of
  636. these.  In addition, you can define your own functions.  *Note
  637. Functions and Scripts::, for information about how to do this.
  638.    The way to use a function is with a "function call" expression,
  639. which consists of the function name followed by a list of "arguments"
  640. in parentheses. The arguments are expressions which give the raw
  641. materials for the calculation that the function will do.  When there is
  642. more than one argument, they are separated by commas.  If there are no
  643. arguments, you can omit the parentheses, but it is a good idea to
  644. include them anyway, to clearly indicate that a function call was
  645. intended.  Here are some examples:
  646.      sqrt (x^2 + y^2)      # One argument
  647.      ones (n, m)           # Two arguments
  648.      rand ()               # No arguments
  649.    Each function expects a particular number of arguments.  For
  650. example, the `sqrt' function must be called with a single argument, the
  651. number to take the square root of:
  652.      sqrt (ARGUMENT)
  653.    Some of the built-in functions take a variable number of arguments,
  654. depending on the particular usage, and their behavior is different
  655. depending on the number of arguments supplied.
  656.    Like every other expression, the function call has a value, which is
  657. computed by the function based on the arguments you give it.  In this
  658. example, the value of `sqrt (ARGUMENT)' is the square root of the
  659. argument.  A function can also have side effects, such as assigning the
  660. values of certain variables or doing input or output operations.
  661.    Unlike most languages, functions in Octave may return multiple
  662. values.  For example, the following statement
  663.      [u, s, v] = svd (a)
  664. computes the singular value decomposition of the matrix `a' and assigns
  665. the three result matrices to `u', `s', and `v'.
  666.    The left side of a multiple assignment expression is itself a list of
  667. expressions, and is allowed to be a list of variable names or index
  668. expressions.  See also *Note Index Expressions::, and *Note Assignment
  669. Ops::.
  670. * Menu:
  671. * Call by Value::
  672. * Recursion::
  673. File: octave,  Node: Call by Value,  Next: Recursion,  Prev: Calling Functions,  Up: Calling Functions
  674. Call by Value
  675. -------------
  676.    In Octave, unlike Fortran, function arguments are passed by value,
  677. which means that each argument in a function call is evaluated and
  678. assigned to a temporary location in memory before being passed to the
  679. function.  There is currently no way to specify that a function
  680. parameter should be passed by reference instead of by value.  This
  681. means that it is impossible to directly alter the value of function
  682. parameter in the calling function.  It can only change the local copy
  683. within the function body.  For example, the function
  684.      function f (x, n)
  685.        while (n-- > 0)
  686.          disp (x);
  687.        endwhile
  688.      endfunction
  689. displays the value of the first argument N times.  In this function,
  690. the variable N is used as a temporary variable without having to worry
  691. that its value might also change in the calling function.  Call by
  692. value is also useful because it is always possible to pass constants
  693. for any function parameter without first having to determine that the
  694. function will not attempt to modify the parameter.
  695.    The caller may use a variable as the expression for the argument, but
  696. the called function does not know this: it only knows what value the
  697. argument had.  For example, given a function called as
  698.      foo = "bar";
  699.      fcn (foo)
  700. you should not think of the argument as being "the variable `foo'."
  701. Instead, think of the argument as the string value, `"bar"'.
  702.    Even though Octave uses pass-by-value semantics for function
  703. arguments, values are not copied unnecessarily.  For example,
  704.      x = rand (1000);
  705.      f (x);
  706. does not actually force two 1000 by 1000 element matrices to exist
  707. *unless* the function `f' modifies the value of its argument.  Then
  708. Octave must create a copy to avoid changing the value outside the scope
  709. of the function `f', or attempting (and probably failing!) to modify
  710. the value of a constant or the value of a temporary result.
  711. File: octave,  Node: Recursion,  Prev: Call by Value,  Up: Calling Functions
  712. Recursion
  713. ---------
  714.    With some restrictions(1), recursive function calls are allowed.  A
  715. "recursive function" is one which calls itself, either directly or
  716. indirectly.  For example, here is an inefficient(2) way to compute the
  717. factorial of a given integer:
  718.      function retval = fact (n)
  719.        if (n > 0)
  720.          retval = n * fact (n-1);
  721.        else
  722.          retval = 1;
  723.        endif
  724.      endfunction
  725.    This function is recursive because it calls itself directly.  It
  726. eventually terminates because each time it calls itself, it uses an
  727. argument that is one less than was used for the previous call.  Once the
  728. argument is no longer greater than zero, it does not call itself, and
  729. the recursion ends.
  730.    There is currently no limit on the recursion depth, so infinite
  731. recursion is possible.  If this happens, Octave will consume more and
  732. more memory attempting to store intermediate values for each function
  733. call context until there are no more resources available.  This is
  734. obviously undesirable, and will probably be fixed in some future version
  735. of Octave by allowing users to specify a maximum allowable recursion
  736. depth.
  737.    ---------- Footnotes ----------
  738.    (1)  Some of Octave's function are implemented in terms of functions
  739. that cannot be called recursively.  For example, the ODE solver `lsode'
  740. is ultimately implemented in a Fortran subroutine that cannot be called
  741. recursively, so `lsode' should not be called either directly or
  742. indirectly from within the user-supplied function that `lsode'
  743. requires.  Doing so will result in undefined behavior.
  744.    (2)  It would be much better to use `prod (1:n)', or `gamma (n+1)'
  745. instead, after first checking to ensure that the value `n' is actually a
  746. positive integer.
  747. File: octave,  Node: Arithmetic Ops,  Next: Comparison Ops,  Prev: Calling Functions,  Up: Expressions
  748. Arithmetic Operators
  749. ====================
  750.    The following arithmetic operators are available, and work on scalars
  751. and matrices.
  752. `X + Y'
  753.      Addition.  If both operands are matrices, the number of rows and
  754.      columns must both agree.  If one operand is a scalar, its value is
  755.      added to all the elements of the other operand.
  756. `X .+ Y'
  757.      Element by element addition.  This operator is equivalent to `+'.
  758. `X - Y'
  759.      Subtraction.  If both operands are matrices, the number of rows and
  760.      columns of both must agree.
  761. `X .- Y'
  762.      Element by element subtraction.  This operator is equivalent to
  763.      `-'.
  764. `X * Y'
  765.      Matrix multiplication.  The number of columns of X must agree with
  766.      the number of rows of Y.
  767. `X .* Y'
  768.      Element by element multiplication.  If both operands are matrices,
  769.      the number of rows and columns must both agree.
  770. `X / Y'
  771.      Right division.  This is conceptually equivalent to the expression
  772.           (inverse (y') * x')'
  773.      but it is computed without forming the inverse of Y'.
  774.      If the system is not square, or if the coefficient matrix is
  775.      singular, a minimum norm solution is computed.
  776. `X ./ Y'
  777.      Element by element right division.
  778. `X \ Y'
  779.      Left division.  This is conceptually equivalent to the expression
  780.           inverse (x) * y
  781.      but it is computed without forming the inverse of X.
  782.      If the system is not square, or if the coefficient matrix is
  783.      singular, a minimum norm solution is computed.
  784. `X .\ Y'
  785.      Element by element left division.  Each element of Y is divided by
  786.      each corresponding element of X.
  787. `X ^ Y'
  788. `X ** Y'
  789.      Power operator.  If X and Y are both scalars, this operator
  790.      returns X raised to the power Y.  If X is a scalar and Y is a
  791.      square matrix, the result is computed using an eigenvalue
  792.      expansion.  If X is a square matrix. the result is computed by
  793.      repeated multiplication if Y is an integer, and by an eigenvalue
  794.      expansion if Y is not an integer.  An error results if both X and
  795.      Y are matrices.
  796.      The implementation of this operator needs to be improved.
  797. `X .^ Y'
  798. `X .** Y'
  799.      Element by element power operator.  If both operands are matrices,
  800.      the number of rows and columns must both agree.
  801.      Negation.
  802.      Unary plus.  This operator has no effect on the operand.
  803.      Complex conjugate transpose.  For real arguments, this operator is
  804.      the same as the transpose operator.  For complex arguments, this
  805.      operator is equivalent to the expression
  806.           conj (x.')
  807. `X.''
  808.      Transpose.
  809.    Note that because Octave's element by element operators begin with a
  810. `.', there is a possible ambiguity for statements like
  811.      1./m
  812. because the period could be interpreted either as part of the constant
  813. or as part of the operator.  To resolve this conflict, Octave treats the
  814. expression as if you had typed
  815.      (1) ./ m
  816. and not
  817.      (1.) / m
  818. Although this is inconsistent with the normal behavior of Octave's
  819. lexer, which usually prefers to break the input into tokens by
  820. preferring the longest possible match at any given point, it is more
  821. useful in this case.
  822.  - Built-in Variable: warn_divide_by_zero
  823.      If the value of `warn_divide_by_zero' is nonzero, a warning is
  824.      issued when Octave encounters a division by zero.  If the value is
  825.      0, the warning is omitted.  The default value is 1.
  826. File: octave,  Node: Comparison Ops,  Next: Boolean Expressions,  Prev: Arithmetic Ops,  Up: Expressions
  827. Comparison Operators
  828. ====================
  829.    "Comparison operators" compare numeric values for relationships such
  830. as equality.  They are written using *relational operators*.
  831.    All of Octave's comparison operators return a value of 1 if the
  832. comparison is true, or 0 if it is false.  For matrix values, they all
  833. work on an element-by-element basis.  For example,
  834.      [1, 2; 3, 4] == [1, 3; 2, 4]
  835.           =>  1  0
  836.               0  1
  837.    If one operand is a scalar and the other is a matrix, the scalar is
  838. compared to each element of the matrix in turn, and the result is the
  839. same size as the matrix.
  840. `X < Y'
  841.      True if X is less than Y.
  842. `X <= Y'
  843.      True if X is less than or equal to Y.
  844. `X == Y'
  845.      True if X is equal to Y.
  846. `X >= Y'
  847.      True if X is greater than or equal to Y.
  848. `X > Y'
  849.      True if X is greater than Y.
  850. `X != Y'
  851. `X ~= Y'
  852. `X <> Y'
  853.      True if X is not equal to Y.
  854.    String comparisons may also be performed with the `strcmp' function,
  855. not with the comparison operators listed above.  *Note Strings::.
  856. File: octave,  Node: Boolean Expressions,  Next: Assignment Ops,  Prev: Comparison Ops,  Up: Expressions
  857. Boolean Expressions
  858. ===================
  859. * Menu:
  860. * Element-by-element Boolean Operators::
  861. * Short-circuit Boolean Operators::
  862. File: octave,  Node: Element-by-element Boolean Operators,  Next: Short-circuit Boolean Operators,  Prev: Boolean Expressions,  Up: Boolean Expressions
  863. Element-by-element Boolean Operators
  864. ------------------------------------
  865.    An "element-by-element boolean expression" is a combination of
  866. comparison expressions using the boolean operators "or" (`|'), "and"
  867. (`&'), and "not" (`!'), along with parentheses to control nesting.  The
  868. truth of the boolean expression is computed by combining the truth
  869. values of the corresponding elements of the component expressions.  A
  870. value is considered to be false if it is zero, and true otherwise.
  871.    Element-by-element boolean expressions can be used wherever
  872. comparison expressions can be used.  They can be used in `if' and
  873. `while' statements.  However, if a matrix value used as the condition
  874. in an `if' or `while' statement is only true if *all* of its elements
  875. are nonzero.
  876.    Like comparison operations, each element of an element-by-element
  877. boolean expression also has a numeric value (1 if true, 0 if false) that
  878. comes into play if the result of the boolean expression is stored in a
  879. variable, or used in arithmetic.
  880.    Here are descriptions of the three element-by-element boolean
  881. operators.
  882. `BOOLEAN1 & BOOLEAN2'
  883.      Elements of the result are true if both corresponding elements of
  884.      BOOLEAN1 and BOOLEAN2 are true.
  885. `BOOLEAN1 | BOOLEAN2'
  886.      Elements of the result are true if either of the corresponding
  887.      elements of BOOLEAN1 or BOOLEAN2 is true.
  888. `! BOOLEAN'
  889. `~ BOOLEAN'
  890.      Each element of the result is true if the corresponding element of
  891.      BOOLEAN is false.
  892.    For matrix operands, these operators work on an element-by-element
  893. basis.  For example, the expression
  894.      [1, 0; 0, 1] & [1, 0; 2, 3]
  895. returns a two by two identity matrix.
  896.    For the binary operators, the dimensions of the operands must
  897. conform if both are matrices.  If one of the operands is a scalar and
  898. the other a matrix, the operator is applied to the scalar and each
  899. element of the matrix.
  900.    For the binary element-by-element boolean operators, both
  901. subexpressions BOOLEAN1 and BOOLEAN2 are evaluated before computing the
  902. result.  This can make a difference when the expressions have side
  903. effects.  For example, in the expression
  904.      a & b++
  905. the value of the variable B is incremented even if the variable A is
  906. zero.
  907.    This behavior is necessary for the boolean operators to work as
  908. described for matrix-valued operands.
  909. File: octave,  Node: Short-circuit Boolean Operators,  Prev: Element-by-element Boolean Operators,  Up: Boolean Expressions
  910. Short-circuit Boolean Operators
  911. -------------------------------
  912.    Combined with the implicit conversion to scalar values in `if' and
  913. `while' conditions, Octave's element-by-element boolean operators are
  914. often sufficient for performing most logical operations.  However, it
  915. is sometimes desirable to stop evaluating a boolean expression as soon
  916. as the overall truth value can be determined.  Octave's "short-circuit"
  917. boolean operators work this way.
  918. `BOOLEAN1 && BOOLEAN2'
  919.      The expression BOOLEAN1 is evaluated and converted to a scalar
  920.      using the equivalent of the operation `all (all (BOOLEAN1))'.  If
  921.      it is false, the result of the overall expression is 0.  If it is
  922.      true, the expression BOOLEAN2 is evaluated and converted to a
  923.      scalar using the equivalent of the operation `all (all
  924.      (BOOLEAN1))'.  If it is true, the result of the overall expression
  925.      is 1.  Otherwise, the result of the overall expression is 0.
  926. `BOOLEAN1 || BOOLEAN2'
  927.      The expression BOOLEAN1 is evaluated and converted to a scalar
  928.      using the equivalent of the operation `all (all (BOOLEAN1))'.  If
  929.      it is true, the result of the overall expression is 1.  If it is
  930.      false, the expression BOOLEAN2 is evaluated and converted to a
  931.      scalar using the equivalent of the operation `all (all
  932.      (BOOLEAN1))'.  If it is true, the result of the overall expression
  933.      is 1.  Otherwise, the result of the overall expression is 0.
  934.    The fact that both operands may not be evaluated before determining
  935. the overall truth value of the expression can be important.  For
  936. example, in the expression
  937.      a && b++
  938. the value of the variable B is only incremented if the variable A is
  939. nonzero.
  940.    This can be used to write somewhat more concise code.  For example,
  941. it is possible write
  942.      function f (a, b, c)
  943.        if (nargin > 2 && isstr (c))
  944.          ...
  945. instead of having to use two `if' statements to avoid attempting to
  946. evaluate an argument that doesn't exist.  For example, without the
  947. short-circuit feature, it would be necessary to write
  948.      function f (a, b, c)
  949.        if (nargin > 2)
  950.          if (isstr (c))
  951.            ...
  952.    Writing
  953.      function f (a, b, c)
  954.        if (nargin > 2 & isstr (c))
  955.          ...
  956. would result in an error if `f' were called with one or two arguments
  957. because Octave would be forced to try to evaluate both of the operands
  958. for the operator `&'.
  959. File: octave,  Node: Assignment Ops,  Next: Increment Ops,  Prev: Boolean Expressions,  Up: Expressions
  960. Assignment Expressions
  961. ======================
  962.    An "assignment" is an expression that stores a new value into a
  963. variable.  For example, the following expression assigns the value 1 to
  964. the variable `z':
  965.      z = 1
  966.    After this expression is executed, the variable `z' has the value 1.
  967. Whatever old value `z' had before the assignment is forgotten.  The `='
  968. sign is called an "assignment operator".
  969.    Assignments can store string values also.  For example, the following
  970. expression would store the value `"this food is good"' in the variable
  971. `message':
  972.      thing = "food"
  973.      predicate = "good"
  974.      message = [ "this " , thing , " is " , predicate ]
  975. (This also illustrates concatenation of strings.)
  976.    Most operators (addition, concatenation, and so on) have no effect
  977. except to compute a value.  If you ignore the value, you might as well
  978. not use the operator.  An assignment operator is different.  It does
  979. produce a value, but even if you ignore the value, the assignment still
  980. makes itself felt through the alteration of the variable.  We call this
  981. a "side effect".
  982.    The left-hand operand of an assignment need not be a variable (*note
  983. Variables::.).  It can also be an element of a matrix (*note Index
  984. Expressions::.) or a list of return values (*note Calling
  985. Functions::.).  These are all called "lvalues", which means they can
  986. appear on the left-hand side of an assignment operator.  The right-hand
  987. operand may be any expression.  It produces the new value which the
  988. assignment stores in the specified variable, matrix element, or list of
  989. return values.
  990.    It is important to note that variables do *not* have permanent types.
  991. The type of a variable is simply the type of whatever value it happens
  992. to hold at the moment.  In the following program fragment, the variable
  993. `foo' has a numeric value at first, and a string value later on:
  994.      octave:13> foo = 1
  995.      foo = 1
  996.      octave:13> foo = "bar"
  997.      foo = bar
  998. When the second assignment gives `foo' a string value, the fact that it
  999. previously had a numeric value is forgotten.
  1000.    Assignment of a scalar to an indexed matrix sets all of the elements
  1001. that are referenced by the indices to the scalar value.  For example, if
  1002. `a' is a matrix with at least two columns,
  1003.      a(:, 2) = 5
  1004. sets all the elements in the second column of `a' to 5.
  1005.    Assigning an empty matrix `[]' works in most cases to allow you to
  1006. delete rows or columns of matrices and vectors.  *Note Empty Matrices::.
  1007. For example, given a 4 by 5 matrix A, the assignment
  1008.      A (3, :) = []
  1009. deletes the third row of A, and the assignment
  1010.      A (:, 1:2:5) = []
  1011. deletes the first, third, and fifth columns.
  1012.    An assignment is an expression, so it has a value.  Thus, `z = 1' as
  1013. an expression has the value 1.  One consequence of this is that you can
  1014. write multiple assignments together:
  1015.      x = y = z = 0
  1016. stores the value 0 in all three variables.  It does this because the
  1017. value of `z = 0', which is 0, is stored into `y', and then the value of
  1018. `y = z = 0', which is 0, is stored into `x'.
  1019.    This is also true of assignments to lists of values, so the
  1020. following is a valid expression
  1021.      [a, b, c] = [u, s, v] = svd (a)
  1022. that is exactly equivalent to
  1023.      [u, s, v] = svd (a)
  1024.      a = u
  1025.      b = s
  1026.      c = v
  1027.    In expressions like this, the number of values in each part of the
  1028. expression need not match.  For example, the expression
  1029.      [a, b, c, d] = [u, s, v] = svd (a)
  1030. is equivalent to the expression above, except that the value of the
  1031. variable `d' is left unchanged, and the expression
  1032.      [a, b] = [u, s, v] = svd (a)
  1033. is equivalent to
  1034.      [u, s, v] = svd (a)
  1035.      a = u
  1036.      b = s
  1037.    You can use an assignment anywhere an expression is called for.  For
  1038. example, it is valid to write `x != (y = 1)' to set `y' to 1 and then
  1039. test whether `x' equals 1.  But this style tends to make programs hard
  1040. to read.  Except in a one-shot program, you should rewrite it to get
  1041. rid of such nesting of assignments.  This is never very hard.
  1042. File: octave,  Node: Increment Ops,  Next: Operator Precedence,  Prev: Assignment Ops,  Up: Expressions
  1043. Increment Operators
  1044. ===================
  1045.    *Increment operators* increase or decrease the value of a variable
  1046. by 1.  The operator to increment a variable is written as `++'.  It may
  1047. be used to increment a variable either before or after taking its value.
  1048.    For example, to pre-increment the variable X, you would write `++X'.
  1049. This would add one to X and then return the new value of X as the
  1050. result of the expression.  It is exactly the same as the expression `X
  1051. = X + 1'.
  1052.    To post-increment a variable X, you would write `X++'.  This adds
  1053. one to the variable X, but returns the value that X had prior to
  1054. incrementing it.  For example, if X is equal to 2, the result of the
  1055. expression `X++' is 2, and the new value of X is 3.
  1056.    For matrix and vector arguments, the increment and decrement
  1057. operators work on each element of the operand.
  1058.    Here is a list of all the increment and decrement expressions.
  1059. `++X'
  1060.      This expression increments the variable X.  The value of the
  1061.      expression is the *new* value of X.  It is equivalent to the
  1062.      expression `X = X + 1'.
  1063. `--X'
  1064.      This expression decrements the variable X.  The value of the
  1065.      expression is the *new* value of X.  It is equivalent to the
  1066.      expression `X = X - 1'.
  1067. `X++'
  1068.      This expression causes the variable X to be incremented.  The
  1069.      value of the expression is the *old* value of X.
  1070. `X--'
  1071.      This expression causes the variable X to be decremented.  The
  1072.      value of the expression is the *old* value of X.
  1073.    It is not currently possible to increment index expressions.  For
  1074. example, you might expect that the expression `V(4)++' would increment
  1075. the fourth element of the vector V, but instead it results in a parse
  1076. error.  This problem may be fixed in a future release of Octave.
  1077. File: octave,  Node: Operator Precedence,  Prev: Increment Ops,  Up: Expressions
  1078. Operator Precedence
  1079. ===================
  1080.    "Operator precedence" determines how operators are grouped, when
  1081. different operators appear close by in one expression.  For example,
  1082. `*' has higher precedence than `+'.  Thus, the expression `a + b * c'
  1083. means to multiply `b' and `c', and then add `a' to the product (i.e.,
  1084. `a + (b * c)').
  1085.    You can overrule the precedence of the operators by using
  1086. parentheses.  You can think of the precedence rules as saying where the
  1087. parentheses are assumed if you do not write parentheses yourself.  In
  1088. fact, it is wise to use parentheses whenever you have an unusual
  1089. combination of operators, because other people who read the program may
  1090. not remember what the precedence is in this case.  You might forget as
  1091. well, and then you too could make a mistake.  Explicit parentheses will
  1092. help prevent any such mistake.
  1093.    When operators of equal precedence are used together, the leftmost
  1094. operator groups first, except for the assignment and exponentiation
  1095. operators, which group in the opposite order.  Thus, the expression `a
  1096. - b + c' groups as `(a - b) + c', but the expression `a = b = c' groups
  1097. as `a = (b = c)'.
  1098.    The precedence of prefix unary operators is important when another
  1099. operator follows the operand.  For example, `-x^2' means `-(x^2)',
  1100. because `-' has lower precedence than `^'.
  1101.    Here is a table of the operators in Octave, in order of increasing
  1102. precedence.
  1103. `statement separators'
  1104.      `;', `,'.
  1105. `assignment'
  1106.      `='.  This operator groups right to left.
  1107. `logical "or" and "and"'
  1108.      `||', `&&'.
  1109. `element-wise "or" and "and"'
  1110.      `|', `&'.
  1111. `relational'
  1112.      `<', `<=', `==', `>=', `>', `!=', `~=', `<>'.
  1113. `colon'
  1114.      `:'.
  1115. `add, subtract'
  1116.      `+', `-'.
  1117. `multiply, divide'
  1118.      `*', `/', `\', `.\', `.*', `./'.
  1119. `transpose'
  1120.      `'', `.''
  1121. `unary plus, minus, increment, decrement, and ``not'''
  1122.      `+', `-', `++', `--', `!', `~'.
  1123. `exponentiation'
  1124.      `^', `**', `.^', `.**'.
  1125.